export {};

// 对后台返回的数据进行类型定义
type User = {
  name: string;
  age: number;
};

type Goods = {
  id: number;
  goodsName: string;
};

// 响应数据类型
type UserResType = {
  msg: string;
  code: number;
  data: User;
};

type GoodsResType = {
  msg: string;
  code: number;
  data: Goods;
};

// 将来可能增加的类型....

// 使用泛型解决上述问题
type ResType<Type> = {
  msg: string;
  code: number;
  data: Type;
};

// 生成不同的类型
type UserResType2 = ResType<User>;
type GoodsResType2 = ResType<Goods>;
